Page({
    data: {
        list: ['全部', '待付款', '待发货', '待收货', '已收货'],
        clickNumber: 0,
    },
    updateSelectedPage: function(current) {
        var current = current;
        var itemWidth = this.data.itemWidth;//一个标签的宽度
        var activeWidth = (current-3) * itemWidth;//重点：重新定义固定轮播点（指定哪个位置轮播）
        this.setData({
            navScrollLeft: activeWidth,
            clickNumber: current,
        })
    },

    //点击上方文字  切换
    onCenterTap: function(event) {
        console.log(event);
        var current = event.target.dataset.current;
        this.updateSelectedPage(current);
    },

    // 滚动切换标签样式
    onChangeSwipeTap: function(event) {

        var current = event.detail.current;
        console.log(current);
        this.updateSelectedPage(current);
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function(options) {
        var height = wx.getSystemInfoSync().windowHeight;
        var width = wx.getSystemInfoSync().windowWidth;
        var itemWidth = width * 0.172*0.88;//对应wxss
        this.setData({
            height: height,
            width: width,
            itemWidth: itemWidth
        })
    }
});